export const getStorage = <T>(key: string): T | undefined => {
  try {
    return wx.getStorageSync(key)
  } catch (error) {
    console.log("本地存储获取失败" + error.message);
    return undefined
  }
}

export const setStorage = <T>(key: string, value: T): void => {
  try {
    wx.setStorageSync(key, value)
  } catch (error) {
    console.log("本地存储设置失败" + error.message);
  }
}
export const removeStorage = (key: string): void => {
  try {
    wx.removeStorageSync(key)
  } catch (error) {
    console.log("本地存储移除失败" + error.message);
  }
}

export const clearStorage = () => {
  try {
    wx.clearStorageSync()
  } catch (error) {
    console.log("本地存储清空失败" + error.message);
  }
}